<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增用户提现申请')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-userWithdraw-add">
            <h4 class="form-header h4">用户提现申请信息</h4>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">提现用户：</label>
                <div class="col-sm-8">
                    <input name="userId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">提现金额：</label>
                <div class="col-sm-8">
                    <input name="amount" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">身份证号：</label>
                <div class="col-sm-8">
                    <input name="idcard" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">1银行卡 2支付宝：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('bind_type')}">
                        <input type="radio" th:id="${'bindType_' + dict.dictCode}" name="bindType" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'bindType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">开户银行：</label>
                <div class="col-sm-8">
                    <select name="bankType" class="form-control m-b">
                        <option value="">所有</option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">开户行账号：</label>
                <div class="col-sm-8">
                    <input name="bankNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">支付宝账号：</label>
                <div class="col-sm-8">
                    <input name="alipayNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">打款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="remitTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">打款流水号：</label>
                <div class="col-sm-8">
                    <input name="serialNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">Y是N否：</label>
                <div class="col-sm-8">
                    <input name="deleted" class="form-control" type="text">
                </div>
            </div>
            <h4 class="form-header h4">用户信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/userWithdraw"
        var userTypeDatas = [[${@dict.getType('web_user_type')}]];
        var statusDatas = [[${@dict.getType('sys_normal_disable')}]];
        var realAuthDatas = [[${@dict.getType('auth_status')}]];
        $("#form-userWithdraw-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-userWithdraw-add').serialize());
            }
        }

        $("input[name='remitTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(function() {
            var options = {
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'username',
                    align: 'center',
                    title: '用户名',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].username' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'password',
                    align: 'center',
                    title: '密码',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].password' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'dealPass',
                    align: 'center',
                    title: '交易密码',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].dealPass' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'nickname',
                    align: 'center',
                    title: '昵称',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].nickname' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'realname',
                    align: 'center',
                    title: '真实姓名',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].realname' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'wxOpenId',
                    align: 'center',
                    title: '微信OPENID',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].wxOpenId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'qqOpenId',
                    align: 'center',
                    title: 'qqopenID',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].qqOpenId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'mobile',
                    align: 'center',
                    title: '手机号',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].mobile' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'userType',
                    align: 'center',
                    title: '1普通会员 2回收员 3管理者',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].userType' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'status',
                    align: 'center',
                    title: '0正常 1停用',
                    formatter: function(value, row, index) {
                        var name = $.common.sprintf("webUserList[%s].status", index);
                        return $.common.dictToSelect(statusDatas, value, name);
                    }
                },
                {
                    field: 'headPic',
                    align: 'center',
                    title: '头像',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].headPic' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'parentId',
                    align: 'center',
                    title: '推荐人ID',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].parentId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'parentTime',
                    align: 'center',
                    title: '推荐时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].parentTime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'realAuth',
                    align: 'center',
                    title: '是否实名认证0否 1审核中 2完成审核 3未通过',
                    formatter: function(value, row, index) {
                        var name = $.common.sprintf("webUserList[%s].realAuth", index);
                        return $.common.dictToSelect(realAuthDatas, value, name);
                    }
                },
                {
                    field: 'recommDate',
                    align: 'center',
                    title: '推荐时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].recommDate' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'lastLoginDate',
                    align: 'center',
                    title: '最后登录时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].lastLoginDate' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'lastLoginIp',
                    align: 'center',
                    title: '最后登录的IP',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].lastLoginIp' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'recommCode',
                    align: 'center',
                    title: '推荐码',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].recommCode' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'sourceType',
                    align: 'center',
                    title: '注册来源1App 2微信 3QQ 4后台',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].sourceType' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'errorCount',
                    align: 'center',
                    title: '密码错误数',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].errorCount' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'earnings',
                    align: 'center',
                    title: '收益',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].earnings' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'createBy',
                    align: 'center',
                    title: '创建人',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].createBy' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'createTime',
                    align: 'center',
                    title: '创建时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].createTime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'updateBy',
                    align: 'center',
                    title: '更新人',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].updateBy' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'updateTime',
                    align: 'center',
                    title: '更新时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].updateTime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'deleted',
                    align: 'center',
                    title: 'Y是N否',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='webUserList[%s].deleted' value='%s'>", index, value);
                        return html;
                    }
                
                }]
            };
            $.table.init(options);
        });

        function addColumn() {
            var count = $("#" + table.options.id).bootstrapTable('getData').length;
            sub.editColumn();
        	
            $("#" + table.options.id).bootstrapTable('insertRow', {
                index: count,
                row: {
                    index: $.table.serialNumber(count),
                    username: "",
                    password: "",
                    dealPass: "",
                    nickname: "",
                    realname: "",
                    wxOpenId: "",
                    qqOpenId: "",
                    mobile: "",
                    userType: "",
                    status: "",
                    headPic: "",
                    parentId: "",
                    parentTime: "",
                    realAuth: "",
                    recommDate: "",
                    lastLoginDate: "",
                    lastLoginIp: "",
                    recommCode: "",
                    sourceType: "",
                    errorCount: "",
                    earnings: "",
                    createBy: "",
                    createTime: "",
                    updateBy: "",
                    updateTime: "",
                    deleted: ""
                }
            });
        }
    </script>
</body>
</html>